module.exports = {
	prefix: "/bus/extend/MA/shop",
	get: {
		"/detail/by_id/:shop_id": function() {
			var bus = role.getBus(this);
			var shop_id = this.params.shop_id;
			this.body = ResponObj("json", bus.getMAShopById(shop_id))
		},
		"/list/by_MA_id/:MA_id": function() {
			var bus = role.getBus(this);
			var MA_id = this.params.MA_id;
			this.body = ResponObj("json", bus.getMAShopList(MA_id));
		},
		"/list": function() {
			var bus = role.getBus(this);
			this.body = ResponObj("json", bus.getAllShopList());
		},
		"/list/by_state/:state": function() {
			var state = ~~this.params.state;
			var bus = role.getBus(this);
			this.body = ResponObj("json", bus.getAllShopListByState(state));
		}
	},
	post: {
		"/add_shop": function() {
			var bus = role.getBus(this);
			var body = this.request.body;
			this.body = ResponObj("json", bus.addMAShop(body));
		}
	},
	put: {
		"/update_shop/:shop_id": function() {
			var bus = role.getBus(this);
			var shop_id = this.params.shop_id;
			var body = this.request.body;
			this.body = ResponObj("json", bus.updateMAShop(shop_id, body));
		},
	},
	"delete": {
		"/remove_shop/:shop_id": function() {
			var bus = role.getBus(this);
			var shop_id = this.params.shop_id;
			var body = this.request.body;
			bus.removeMAShop(shop_id);
			this.body = ResponObj("string", "success:" + shop_id);
		}
	}
}
var role = require("./role");
var BusCon = require("../../core/bus/_con");
var UserCon = require("../../core/user/_con");
var GoodsCon = require("../../core/goods/_con");
var AchCon = require("../../core/ach/_con");
var db = require("../../core/db/index");
var config = require("../../core/_include/config");
var ResponObj = require("../_include/responObj");